<%@ page trimDirectiveWhitespaces="true" %>
<%@page import="java.util.Map"%>
<%@page import="com.google.gson.Gson"%>
<%@page import="java.util.HashMap"%>
<%@page import="org.json.JSONArray"%>
<%@page import="org.json.JSONObject"%>
<%@page import="java.util.List"%>
<%@page import="org.apache.ibatis.session.SqlSession"%>
<%@page import="com.penta.mybatis.SqlSessionManager"%>
<%@page import="org.apache.ibatis.session.SqlSessionFactory"%>
<%@ page language="java" contentType="text/json; charset=UTF-8" pageEncoding="UTF-8"%>

<%
response.setContentType("application/json");

SqlSession query = SqlSessionManager.getSqlSessionFactory().openSession();

List selectList = query.selectList("role.selectAll");

query.close();


for (int i=0 ; i < selectList.size(); i++)
{
	System.out.println ( selectList.get(i) );
}

/*
JSONObject obj = new JSONObject(selectList);
*/


Gson gg = new Gson();


Map<String, Object> data = new HashMap<String, Object>();

data.put("page", "1");
data.put("total", "1");
data.put("records", selectList.size());
data.put("rows", selectList);
data.put("userdata", "");

System.out.println( gg.toJson(selectList) );
out.println( gg.toJson(selectList) );

%>
